package com.xxx.meter.ui.patrol.machine.info;

import android.graphics.Color;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xxx.meter.R;
import com.xxx.meter.model.http.bean.PatrolBean;

import java.util.List;

public class PatrolMachineInfoAdapter extends BaseQuickAdapter<PatrolBean, BaseViewHolder> {

    PatrolMachineInfoAdapter(@Nullable List<PatrolBean> data) {
        super(R.layout.item_patrol_info, data);
    }

    @Override
    protected void convert(final BaseViewHolder helper, final PatrolBean item) {
        helper.setText(R.id.item_patrol_info_name, item.getRoomname());
        helper.setText(R.id.item_patrol_info_text, item.getValue() + item.getValuesize());
        switch (item.getValuetype()){
            case 0:
                helper.setTextColor(R.id.item_patrol_info_text, Color.parseColor("#333333"));
                break;
            case 1:
                helper.setTextColor(R.id.item_patrol_info_text, Color.parseColor("#F40000"));
                break;
            case 2:
                helper.setTextColor(R.id.item_patrol_info_text, Color.parseColor("#00bfff"));
                break;
        }
    }
}
